<template>
  <div class="nav1">
    <NavTitle title="满意度调查分析" />
    <div class="flex items-center justify-between pt-12px">
      <div class="flex items-center">
        <DwImage class="w-116px h-95px" :src="useImageUrl('k1.png')" />
        <div class="flex-col-center gap-8px">
          <div class="text-34px font-title">{{ infoData.total }}</div>
          <div class="text-20px">参与人数</div>
        </div>
      </div>
      <div class="flex items-center">
        <div class="main_r bg1">
          <div class="font-600">{{ infoData.satiCount }}</div>
          <div>满意</div>
          <div class="font-600 pt-24px">{{ satiCountBl }}%</div>
        </div>
        <div class="main_r bg2 ml-23px">
          <div class="font-600">{{ infoData.dissatiCount }}</div>
          <div>不满意</div>
          <div class="font-600 pt-24px">{{ dissatiCountBl }}%</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, computed } from 'vue'
import NavTitle from '@/components/NavTitle'
import { useImageUrl } from '@/utils'
import { satisfactionApi } from '@/api'

const satiCountBl = computed(() => {
  const { satiCount, total } = infoData.value
  return ((satiCount / total) * 100).toFixed(2)
})

const dissatiCountBl = computed(() => {
  const { dissatiCount, total } = infoData.value
  return ((dissatiCount / total) * 100).toFixed(2)
})

const infoData = ref({})
const getData = async () => {
  const { data } = await satisfactionApi()
  infoData.value = data
}

getData()

</script>

<style lang="scss" scoped>
.nav1 {
  color: #fff;
  .main_r{
    width: 92px;
    height: 91px;
    background-size: 100% 100%;
    text-align: center;
  }
  .bg1{
    background: url(@/assets/k3.png)  0 20px no-repeat;
  }
  .bg2{
    background: url(@/assets/k2.png) 0 20px no-repeat;

  }
}
</style>
